-- ancient_memory
-- created by zhuangsl
-- 施放魔法时，伤害类魔法效果提高x%（可叠加，有上限）

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 施法触发
    trigger = function(who, prop, arg)
        -- 取当前已累加的属性
        local condition = CombatStatusM.queryCondition(who, "ancient_memory") or {};
        local value = condition["value"] or 0;

        -- 达到上限时，只更新回合数
        local limit = tonumber(prop[2]);

        -- 提升，不能超过上限
        value = math.min(value + prop[3], limit);

        -- 持续时间
        local round = CombatM.getRound() + prop[4] + 1;

        local newCondition = {
            ["value"] = value,
            ["end_round"] = round,
        }

        -- 更新状态
        CombatStatusM.applyStatus(who, "ancient_memory", newCondition);

        -- 触发特技发动事件
        EventMgr.fire(event.SPECIAL_SKILL_TRIGGER, { propId = prop[1] });
    end,

    record = function(target, prop, path)
        return false;
    end
};